﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Sector7.Framework.Consts;
using Sector7.Framework.Core;
using Sector7.Framework.Enums;

namespace Sector7.Medical.Controls
{
    /// <summary>
    /// HeaderStrip.xaml 的交互逻辑
    /// </summary>
    public partial class HeaderStrip : UserControl
    {
        #region Accessor
        /// <summary>
        /// 点击关闭事件
        /// </summary>
        public event EventHandler ClickClose = null;
        #endregion

        #region Public functions
        /// <summary>
        /// 更新标题信息
        /// </summary>
        /// <param name="title">控件标题</param>
        public void UpdateTitle(object title)
        {
            lblTitle.Content = title;
        }
        #endregion

        #region Private functions
        private void imgClose_MouseEnter(object sender, MouseEventArgs e)
        {
            imgClose.Source = new BitmapImage(new Uri(string.Format(@"{0}{1}\close_2.png", AppDomain.CurrentDomain.BaseDirectory, C_DirectoryName.IMAGES)));
        }

        private void imgClose_MouseLeave(object sender, MouseEventArgs e)
        {
            imgClose.Source = new BitmapImage(new Uri(string.Format(@"{0}{1}\close_1.png", AppDomain.CurrentDomain.BaseDirectory, C_DirectoryName.IMAGES)));
        }

        private void imgClose_MouseDown(object sender, MouseButtonEventArgs e)
        {
            OnClickClose(new EventArgs());
        }

        /// <summary>
        /// 触发点击关闭事件
        /// </summary>
        /// <param name="e"></param>
        protected virtual void OnClickClose(EventArgs e)
        {
            if (ClickClose != null)
            {
                ClickClose(this, e);
            }
        }
        #endregion

        #region Structure
        public HeaderStrip()
        {
            InitializeComponent();
        }
        #endregion

        #region Inner members
        #endregion
    }
}
